package com.cserver.pro.threadtest;

public class Stage implements Runnable{
    @Override
    public void run() {
        Thread suiDynastyArmy=new ArmyThread("随军");
        Thread farmerArmy=new ArmyThread("农民军");

        suiDynastyArmy.start();
        farmerArmy.start();
        System.out.println("sssssssswwwww");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        ((ArmyThread) suiDynastyArmy).keepRunning=false;
        ((ArmyThread) farmerArmy).keepRunning=false;
        try {
            suiDynastyArmy.join();
            farmerArmy.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("演出结束");
    }


    public static void main(String[] args) {
        Runnable stageRunnable=new Stage();
        Thread threadStage=new Thread(stageRunnable,"舞台");
        threadStage.start();


    }
}
